<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('计划日程')" />
	<link th:href="@{/dhecp/css/dh-calendar.css?v=7}" rel="stylesheet"/>
</head>
<style>

</style>
<body class="no-skin" style="padding:5px 10px 10px;">
<div id="commonTools">
    <div id="common_search">
	    <div id="common_left">
           	<span>选择 年-月：</span><input type="text" class="layui-input" id="year_month">
        </div>
	    <div id="common_right">
	    	<a href="/crm/weeklyplan" class="layui-btn layui-btn-warm layui-table-tools"><i class="dhicon dh-list-alt"></i> 列表</a>
	    </div>
	</div>
</div>
<div id="fullcalendar"></div>
<div class="hide" id="dialog_weekly"></div>
<script th:src="@{/js/jquery/jquery.min.js}"></script>
<script th:src="@{/js/plugins/fullcalendar/selfFullCalendar.js?v=17}"></script>
<script th:src="@{/js/layuiadmin-1.2.1/layui/layui.js?v=2}"></script>
    <script th:src="@{/dhecp/js/dh-common.js?v=53}"></script>
<script th:inline="javascript">
    //<![CDATA[
    var source = [[${list}]],
    dPlanDate = [[${dPlanDate}]];
    //]]>
</script>
<script type="text/javascript">
$("#commonTools").css("background",logo_color);
var openRowUrl = "/crm/weeklyplan/edit?nid=",
	yearVal	;
var $,layer,laydate;//定义layui模块
layui.use(['laydate','layer'], function () {
	$ = layui.$,layer = layui.layer,laydate = layui.laydate
	laydate.render({elem: '#year_month',type: 'month',value: dPlanDate,showBottom:false,
		change: function(value, date, endDate){
			window.location.href='/crm/weeklyplan/weeklyCalendar?dPlanDate='+value;
		}
	});
})
$(function(){
	function showCalendar(){
		var year_monthArr = dPlanDate.split("-");
		var yearVal = year_monthArr[0];
		var monthVal = year_monthArr[1];
		var monthInt = 0;var yearInt = 0;
		if(!yearVal){
			yearInt = new Date().getFullYear();
			monthInt = new Date().getMonth();
		}else{
			monthInt = parseInt(monthVal) - 1;
			yearInt = parseInt(yearVal);
		}
		$("#fullcalendar").selfFullCalendar({
			year:yearInt,
			month:monthInt,
			dataArr:source,
		    clickLink:function(e){
				var idValArr=e.target.id.split("_");
				parent.layui.index.openTabsPage(openRowUrl+idValArr[1], '周报计划('+idValArr[2]+')');
			},
			clickMore:function(e){
				var idValArr=e.target.id.split("_");
				parent.layui.index.openTabsPage(openRowUrl+idValArr[1], '周报计划('+idValArr[2]+')');
			}
		});
		$(".text_content_li a").hover(function(){
			$(this).css("color", logo_color);
			$(this).attr("lay-tips", $(this).text());
			$(this).attr("lay-direction", $(this).parents('td').index() == 6 ? 4 : ($(this).parents('.contentDiv').prev().text() > 15 ? 1 : 3));
		},function(){
			$(this).css("color", "#333");
		})
	}
	showCalendar();
})
</script>
</body>
</html>